<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 6.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/favicon.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.7.2/css/all.min.css" integrity="sha256-dABdfBfUoC8vJUBOwGVdm8L9qlMWaHTIfXt+7GnZCIo=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"blog.csgrandeur.cn","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.22.0","exturl":false,"sidebar":{"position":"left","width_expanded":320,"width_dual_column":240,"display":"post","padding":18,"offset":12},"hljswrap":true,"copycode":{"enable":true,"style":"default"},"fold":{"enable":false,"height":500},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"duration":200,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"top_n_per_article":1,"unescape":false,"preload":false,"trigger":"auto"}}</script><script src="/js/config.js"></script>

    <meta name="description" content="最近喜欢看艾森伯格的电影，于是刷列表之余还是想重温下经典《社交网络》。">
<meta property="og:type" content="article">
<meta property="og:title" content="二刷《社交网络》">
<meta property="og:url" content="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/index.html">
<meta property="og:site_name" content="CSGrandeur&#39;s Thinking">
<meta property="og:description" content="最近喜欢看艾森伯格的电影，于是刷列表之余还是想重温下经典《社交网络》。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/post.jpg">
<meta property="og:image" content="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/1-1.jpg">
<meta property="og:image" content="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/1-2.jpg">
<meta property="og:image" content="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/2-1.jpg">
<meta property="og:image" content="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/2-2.jpg">
<meta property="og:image" content="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/3-1.jpg">
<meta property="og:image" content="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/3-2.jpg">
<meta property="og:image" content="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/3-3.jpg">
<meta property="og:image" content="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/4.jpg">
<meta property="og:image" content="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/5.jpg">
<meta property="og:image" content="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/6.jpg">
<meta property="og:image" content="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/7.jpg">
<meta property="og:image" content="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/8.jpg">
<meta property="article:published_time" content="2016-10-18T11:36:55.000Z">
<meta property="article:modified_time" content="2025-03-06T02:27:46.945Z">
<meta property="article:author" content="CSGrandeur">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/post.jpg">


<link rel="canonical" href="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/">


<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/","path":"2016-10-18-again-the-social-network/","title":"二刷《社交网络》"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>二刷《社交网络》 | CSGrandeur's Thinking</title>
  

  <script src="/js/third-party/analytics/baidu-analytics.js"></script>
  <script async src="https://hm.baidu.com/hm.js?7958adf931092425a489778560129144"></script>







  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">CSGrandeur's Thinking</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">Cogito Ergo Sum</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
      <div class="search-header">
        <span class="search-icon">
          <i class="fa fa-search"></i>
        </span>
        <div class="search-input-container">
          <input autocomplete="off" autocapitalize="off" maxlength="80"
                placeholder="搜索..." spellcheck="false"
                type="search" class="search-input">
        </div>
        <span class="popup-btn-close" role="button">
          <i class="fa fa-times-circle"></i>
        </span>
      </div>
      <div class="search-result-container">
        <div class="search-result-icon">
          <i class="fa fa-spinner fa-pulse fa-5x"></i>
        </div>
      </div>
    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-overview-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">CSGrandeur</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">72</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">6</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">22</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://blog.csgrandeur.cn/2016-10-18-again-the-social-network/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="CSGrandeur">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="CSGrandeur's Thinking">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="二刷《社交网络》 | CSGrandeur's Thinking">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          二刷《社交网络》
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2016-10-18 19:36:55" itemprop="dateCreated datePublished" datetime="2016-10-18T19:36:55+08:00">2016-10-18</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">更新于</span>
      <time title="修改时间：2025-03-06 10:27:46" itemprop="dateModified" datetime="2025-03-06T10:27:46+08:00">2025-03-06</time>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><p>最近喜欢看艾森伯格的电影，于是刷列表之余还是想重温下经典《社交网络》。</p>
<span id="more"></span>
<img src="/2016-10-18-again-the-social-network/post.jpg" class="">
<p>不过不想做影评或者大发感慨，只是仔细看了一下电影开始 10
分钟左右扎克"hack"的方法。电脑还在等待编译“开源大法”，就写篇日志吧。
也许是电影为了让大众容易看懂，也许是因为故事背景在十多年前，互联网今非昔比，所以方法并没有多么极客、高端，也就没什么必要写到技术博客了，放在qq空间里纯当娱乐。</p>
<p><br/></p>
<p>首先有个背景，估计节省了扎克很多麻烦，看起来系统是分楼栋来的，那么男女的分开的，不然的话那年代从照片分男女估计就难倒二年级的小扎克了。</p>
<p><br/></p>
<img src="/2016-10-18-again-the-social-network/1-1.jpg" class="">
<img src="/2016-10-18-again-the-social-network/1-2.jpg" class="">
<blockquote>
<p>First up is <strong>Kirkland</strong>. They keep everything open and
allow indexes in their Apache configuration. So a little Wget magic is
all that's necessary to download the entire Kirkland facebook. Kids'
stuff.</p>
</blockquote>
<p>apache允许目录访问，而且照片连号，也就是说照片可以直接下载。wget很方便的命令行下载，通配符jpg就可以了。</p>
<p><br/></p>
<img src="/2016-10-18-again-the-social-network/2-1.jpg" class="">
<img src="/2016-10-18-again-the-social-network/2-2.jpg" class="">
<blockquote>
<p>Next is Eliot. They're also open, but with no indexes on Apache. I
can run an empty search and it returns all of the images in the database
in a single page. And I can save the page and Mozilla will save all the
images for me. Excellent. Moving right along.</p>
</blockquote>
<p>跑一个空搜索就能搜到所有人了，说明这个楼的系统是模糊匹配的，如果是数据库的话，说不定还可以注入。网页上做空白搜索显示所有照片，浏览器有缓存自然保存了照片，当然批量下载也可以。</p>
<p><br/></p>
<img src="/2016-10-18-again-the-social-network/3-1.jpg" class="">
<img src="/2016-10-18-again-the-social-network/3-2.jpg" class="">
<img src="/2016-10-18-again-the-social-network/3-3.jpg" class="">
<blockquote>
<p><strong>Lowell</strong> has some security. They require a user
name/password combo, and I'm gonna go ahead and say they don't have
access to the main FAS user database, so they have no way of detecting
an intrusion.</p>
</blockquote>
<p>这个楼需要用户名密码。这里光看台词还理解不了，需要结合电影中扎克的博客。博客讲到，分开的系统没有权限连接学校总用户系统，所以这个分系统没法拥有每个学生的密码，即需要给学生分发密码。而统一公布并不靠谱，一一分发相当困难，那就尝试每个人都有的信息，于是扎克尝试了学生名字+学号，首先他试了自己的，不知道是取消了还是没通过，后面又试了一个bolson，至于怎么得到的就没说了，姓名学号这个东西也不难得到。
接着是他博客的内容，图片是分开的网页上的，那就需要脚本上场了，他用的perl（记得上次刷的时候中文字幕是Python，看来字幕组也有有立场的程序猿）。
仅仅是下载有规律地址的图片的话，这类脚本一般比较简单，几行代码的事。
台词提到因为系统没有FAS user
database的权限，所以他们无法察觉到入侵，这个因果关系不是太明了。
也许是扎克解释了下刚刚用自己名字登录了一下的问题吧，比如系统有登录日志，发现非本楼人员之类的。（锁IP地址不是一下就找到你了么。。那年头校园里都是独立IP）</p>
<p><br/></p>
<img src="/2016-10-18-again-the-social-network/4.jpg" class="">
<blockquote>
<p><strong>Adams</strong> has no security but limits the number of
results to 20 a page. All I have to is break up the same script I used
on Lowell and it's set.</p>
</blockquote>
<p>每页20个结果，修改一下Lowell楼用的perl脚本。</p>
<p><br/></p>
<img src="/2016-10-18-again-the-social-network/5.jpg" class="">
<blockquote>
<p><strong>Quincy</strong> has no online Facebook, what a sham. Nothing
I can do about that.</p>
</blockquote>
<p>人家不放照片到网站上，小扎也没办法了。</p>
<p><br/></p>
<img src="/2016-10-18-again-the-social-network/6.jpg" class="">
<blockquote>
<p><strong>Dunster</strong> is intense. Not only is there no public
directory but there's no directory at all. You have to do searches and
every search returns more than 20 matches nothing is returned. Once you
do get results they don't link directly to the images, they link to a
PHP that redirects or something. Weird. This maybe difficult, I'll come
back later.</p>
</blockquote>
<p>没有列出的条目，搜索结果超过20还会隐藏，查到的结果，点过去不是图片也不是直连个人网页，而是一个重定向跳转，跳转目的地还各不相同。
这个编程筛选复杂许多，小扎暂时放弃。估计真要搞的话，当晚他是搞不完了。</p>
<p><br/></p>
<img src="/2016-10-18-again-the-social-network/7.jpg" class="">
<blockquote>
<p><strong>Leverett</strong> is a little better. I'ts still make you
search but you can do an empty search and gets links to pages with every
student's picture. It's slightly obnoxious that they let you view one
picture at a time. And there's no way I'm going to go 500 hundred pages
to download pics one at a time. So its definitely necessary to break out
Emacs and modify that Perl script.</p>
</blockquote>
<p>又是用空搜索，得到链接去个人主页，页面上有照片。看来这些照片的地址是没规律的。这里中文字幕组给“break
out Emacs and modify that Perl
script”翻译成关掉Emacs来修改perl脚本，上次看的时候就楞了一下，不知道是不是反过来翻译成“祭出神器”Emacs来修改perl脚本更合适。。。不过我是不参与Emacs和Vim之战的，我是IDE党。
搜索-&gt;进网页-&gt;获取图片，标准的爬虫脚本了，主要是根据html内容写正则匹配，获取元素，代码量也不会太多。</p>
<p><br/></p>
<p>Done.</p>
<img src="/2016-10-18-again-the-social-network/8.jpg" class="">
<p>电影中小扎这晚的抓图工作就这么多了。</p>
<p>侧面再次显示了美国高中生活的丰富多彩，国内高中能接触编程的也只有OI竞赛的神牛们了，然而能上个满意学校的基本都是金字塔尖的。写个小爬虫脚本多少需要对html、
php、一个脚本语言、apache这些有一定的了解，十多年前的小扎做这些就是玩儿的，十多年后工具发达数倍的时代，我们光靠大一一年玩到这个程度的那真是对编程够钟爱。</p>

    </div>

    
    
    

    <footer class="post-footer">

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2016-05-13-python-libsvm/" rel="prev" title="Python使用LibSVM">
                  <i class="fa fa-angle-left"></i> Python使用LibSVM
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2017-02-09-csu-oj-complete-plan-10xx/" rel="next" title="CSU-OJ补完计划（一，10xx）">
                  CSU-OJ补完计划（一，10xx） <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






    <div class="comments utterances-container"></div>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">CSGrandeur</span>
  </div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>
  <div class="sidebar-dimmer"></div>
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://fastly.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://fastly.jsdelivr.net/npm/@next-theme/pjax@0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/sidebar.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  <script src="https://fastly.jsdelivr.net/npm/hexo-generator-searchdb@1.4.1/dist/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>







  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://fastly.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


<script class="next-config" data-name="utterances" type="application/json">{"enable":true,"repo":"CSGrandeur/csgrandeur.github.io","issue_term":"pathname","theme":"github-light"}</script>
<script src="/js/third-party/comments/utterances.js"></script>

</body>
</html>
